<template>
    <el-dialog title="游戏设置" v-model="obj.show" :show-close="false">
        <el-form :model="gameSetting">


            <el-form-item label="游戏难度" label-width="120px">
                <el-select v-model="gameSetting.level" placeholder="请选择游戏难度">
                    <el-option label="简单" :value="1"></el-option>
                    <el-option label="初级" :value="2"></el-option>
                    <el-option label="中级" :value="3"></el-option>
                    <el-option label="高级" :value="4"></el-option>
                    <el-option label="地狱" :value="5"></el-option>
                </el-select>
            </el-form-item>

        </el-form>

        <div slot="footer" class="dialog-footer">

            <el-button type="primary" @click="sure">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import {reactive} from "@vue/reactivity";
    import {onMounted,watch} from "@vue/runtime-core";
    export default {
        name: "SnakeMenu",
        props:['show'],
        emits:['sure','cancel'],
        setup(props,context){
            let obj=reactive({
                show:false
            })
            let gameSetting=reactive({
                level:1
            })


            let sure=()=>{
                context.emit('sure',gameSetting)
                obj.show=false

            }
            let cancel=()=>{
                context.emit('cancel',{})
                obj.show=false

            }

            watch(props,(newV,oldV)=>{

                obj.show=newV.show
            })
            onMounted(()=>{

            })
            return{
                obj,
                gameSetting,
                sure,
                cancel
            }
        }
    }
</script>

<style scoped>

</style>